<?php
/* 接收json数据 */
require("../../utils/resolve_json.php");
/* sql操作工具 */
require("../../utils/tools.php");
$code = 3001;
$re_data = array();
$table_name = '角色';
if (!isset($data["name"])) {
    $msg = "创建${table_name}失败,${table_name}名不能为空!";
} else {
    if (SQLTools::insertTB($conn, 'roles', 'role_id,role_name', "NULL,'${data["name"]}'")) {
        $code = 2000;
        $msg = "创建${table_name}成功!";
        $re_data = array("name"=>$data["name"]);
    } else {
        $msg = "创建${table_name}失败,原因未知!";
    }
}
$result = array("code" => $code, "msg" => $msg, "data"=>$re_data);
echo json_encode_mz_urlencode($result);
